﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MBSBusinessEntities;
using System.Transactions;
using MBSVO;
namespace MBSBLC
{
    public partial class BLC
    {
        #region Screen

        ScreenBE screenbe;

        public ScreenVO GetScreenByID(int CinemaID, int ScreenNo)
        {

            screenbe = new ScreenBE();
            screenbe =screenbe.GetScreenByID(CinemaID, ScreenNo);
            ScreenVO screenVO = BLCUtility.convertScreenBEtoVO(screenbe);
            return screenVO;

        }
        /*
                public string CinemaID(int CinemaID,int ScreenNo) { GetScreenByID(CinemaID, ScreenNo); return screenbe.CinemaID.ToString(); }
                public string ScreenNumber(int CinemaID, int ScreenNo) { GetScreenByID(CinemaID, ScreenNo); return screenbe.ScreenNo.ToString(); }
                public string NumberOfSeats(int CinemaID, int ScreenNo) { GetScreenByID(CinemaID, ScreenNo); return screenbe.NumOfSeats.ToString(); }
                public string ScreenIsDeleted(int CinemaID, int ScreenNo) { GetScreenByID(CinemaID, ScreenNo); return screenbe.IsDeleted.ToString(); }
        */

        public bool AddScreen(int CinemaID, string ScreenNo, string NumOfSeats)
        {

            try
            {

                cinemabe = new CinemaBE();

                cinemabe = cinemabe.GetCinemaByID(CinemaID);

                if (cinemabe.IsValid)
                { return cinemabe.AddScreen(Convert.ToInt32(ScreenNo), Convert.ToInt32(NumOfSeats)); }

            }

            catch (Exception ex)
            {
                ErrorMessage = ex.Message;
                return false;
            }

            return false;
        }

        public static string GetScreenException()
        {
            return ScreenBE.ErrorMessage;
        }

        public bool RemoveScreen(int CinemaID, int ScreenNo)
        {

            cinemabe = new CinemaBE();

            cinemabe = cinemabe.GetCinemaByID(CinemaID);

            return cinemabe.RemoveScreen(ScreenNo);

        }


        public Dictionary<int, int> GetAllScreensForACinema(int CinemaID)
        {

            cinemabe = new CinemaBE();

            cinemabe = cinemabe.GetCinemaByID(CinemaID);

            Dictionary<int, int> dct = new Dictionary<int, int>();
            if (cinemabe == null) return dct;

            List<ScreenBE> scrlist = cinemabe.GetAllScreens();
            

            foreach (ScreenBE scrtemp in scrlist)
            {
                dct.Add(scrtemp.ScreenNo, scrtemp.ScreenNo);

            }

            return dct;

        }


        #endregion
    }
}
